package com.zxm.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

import com.alibaba.dubbo.config.annotation.Service;
import com.zxm.mapper.UserInfoMapper;
import com.zxm.pojo.UserInfo;
import com.zxm.pojo.UserInfoExample;
import com.zxm.pojo.UserInfoExample.Criteria;
import com.zxm.service.UserService;
@Service(interfaceName="com.zxm.service.UserService")
@Transactional
public class UserServiceImpl implements UserService {
	@Autowired
	UserInfoMapper userInfoMapper;
	@Override
	public UserInfo userLogin(UserInfo userInfo) {
		UserInfoExample ue=new UserInfoExample();
		Criteria criteria=ue.createCriteria();
		criteria.andUsernameEqualTo(userInfo.getUsername()).andPasswordEqualTo(userInfo.getPassword());
		UserInfo user=null;
		try {
			user=userInfoMapper.selectByExample(ue).get(0);
		}catch (Exception e) {
			return null;
		}
		return user;
	}
}
